package num263;

import java.util.HashMap;

/**
 * 263. 丑数
 * 题目：https://leetcode-cn.com/problems/ugly-number/
 * 三叶姐题解: https://leetcode-cn.com/problems/ugly-number/solution/gong-shui-san-xie-jian-dan-de-fen-qing-k-dlvg/
 *
 *
 */
class Solution {
    public boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        }
        while (n % 2 == 0) n /= 2;
        while (n % 3 == 0) n /= 3;
        while (n % 5 == 0) n /= 5;

        return n == 1;
    }
}
